package com.wangxinyuchuan.demo.prototype;

/**
 * @author wangxinyuchuan
 * @date 2023/4/14 5:29 PM
 */
public class MessageBox implements Product{

    private char c;

    public MessageBox(char c) {
        this.c = c;
    }

    @Override
    public void use(String s) {
        int length = s.getBytes().length;
        for (int i = 0; i < length + 4; i++) {
            System.out.print(c);
        }
        System.out.println("");
        System.out.println(c + " " + s + " " + c);
        for (int i = 0; i < length + 4; i++) {
            System.out.print(c);
        }
        System.out.println("");
    }

    @Override
    public Product createClone() {
        Product product = null;

        try {
            product = (Product) clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return product;
    }
}
